1 /* 2 * Hibernate, Relational Persistence for Idiomatic Java 3 * 4 * Copyright (c) 2010, Red Hat Inc. or third-party contributors as 5 * indicated by the @author tags or express copyright attribution 6 * statements applied by the authors. All third-party contributions are 7 * distributed under license by Red Hat Inc. 8 * 9 * This copyrighted material is made available to anyone wishing to use, modify, 10 * copy, or redistribute it subject to the terms and conditions of the GNU 11 * Lesser General Public License, as published by the Free Software Foundation. 12 * 13 * This program is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 15 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License 16 * for more details. 17 * 18 * You should have received a copy of the GNU Lesser General Public License 19 * along with this distribution; if not, write to: 20 * Free Software Foundation, Inc. 21 * 51 Franklin Street, Fifth Floor 22 * Boston, MA 02110-1301 USA 23 */ 24 package org.hibernate.annotations; 25 import java.lang.annotation.Retention; 26 import java.lang.annotation.Target; 27 28 import static java.lang.annotation.ElementType.PACKAGE; 29 import static java.lang.annotation.ElementType.TYPE; 30 import static java.lang.annotation.RetentionPolicy.RUNTIME; 31 32 /** 33 * Extends {@link javax.persistence.NamedNativeQuery} with Hibernate features 34 * 35 * @author Emmanuel Bernard 36 */ 37 @Target({TYPE, PACKAGE}) 38 @Retention(RUNTIME) 39 public @interface NamedNativeQuery { 40 String name(); 41 42 String query(); 43 44 Class resultClass() default void.class; 45 46 String resultSetMapping() default ""; // name of SQLResultSetMapping 47 /** the flush mode for the query */ 48 FlushModeType flushMode() default FlushModeType.PERSISTENCE_CONTEXT; 49 /** mark the query as cacheable or not */ 50 boolean cacheable() default false; 51 /** the cache region to use */ 52 String cacheRegion() default ""; 53 /** the number of rows fetched by the JDBC Driver per roundtrip */ 54 int fetchSize() default -1; 55 /**the query timeout in seconds*/ 56 int timeout() default -1; 57 58 boolean callable() default false; 59 /**comment added to the SQL query, useful for the DBA */ 60 String comment() default ""; 61 /**the cache mode used for this query*/ 62 CacheModeType cacheMode() default CacheModeType.NORMAL; 63 /**marks whether the results are fetched in read-only mode or not*/ 64 boolean readOnly() default false; 65 }